package wicresoft.servicesImp.expertInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import wicresoft.orm.dao.ExpertBaseInfoMapper;
import wicresoft.orm.entity.ExpertBaseInfo;
import wicresoft.orm.entity.ExpertBaseInfoExample;
import wicresoft.services.expertInfo.ExpertBaseInfoServices;

import java.util.List;

/**
 * Created by Administrator on 2018/3/12.
 */
@Service
public class ExpertBaseInfoServicesImp implements ExpertBaseInfoServices {
    @Autowired
    ExpertBaseInfoMapper expertBaseInfoMapper;

    public int insertSelective(ExpertBaseInfo record) throws Exception {
        return expertBaseInfoMapper.insertSelective(record);
    }

    public ExpertBaseInfo selectByIdCard(String idCard) throws Exception {
        ExpertBaseInfoExample expertBaseInfoExample = new ExpertBaseInfoExample();
        expertBaseInfoExample.createCriteria().andIdcardEqualTo(idCard);

        List<ExpertBaseInfo> expertBaseInfoList = expertBaseInfoMapper.selectByExample(expertBaseInfoExample);
        if (expertBaseInfoList.isEmpty()) {
            return null;
        } else {
           return expertBaseInfoList.remove(0);
        }

    }
}
